package com.taru.wxhsh.config;

import com.taru.wxhsh.filter.AuthFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ApplicationConfig {


    /**
     * 自定义过滤器 实现未登录简单验证,客户要求没有登录不能直接访问内部链接
     * @return
     */
    @Bean
    public FilterRegistrationBean authFilter(){
        FilterRegistrationBean authFilter = new FilterRegistrationBean();
        authFilter.setFilter(new AuthFilter());
        authFilter.addUrlPatterns("/view/*");

        authFilter.setName("authFilter");
        authFilter.setOrder(1);
        return  authFilter;
    }


}
